# create graph
function create_graph(Rk::Vector{Vector{Int}},ds::DiscreteSpace, Ud::Vector{Interval{Float64}}, fxu::Function)
    dim = ds.dim
    dX = ds.dX
    rtree = create_rtree(Rk,ds)
    G = SimpleDiGraph(length(Rk))

    @inbounds for (i,bxi) in enumerate(Rk)
        bx = [dX[j][bxi[j]] for j in 1:dim]
        bxy = fxu(bx,Ud)
        yr = Rect(Tuple(bxy[j].lo for j in 1:dim),Tuple(bxy[j].hi for j in 1:dim))
        bxp = intersects_with(rtree, yr)

        @inbounds for bxpj in bxp
            if i != bxpj.val
                add_edge!(G,i,bxpj.val)
            end
        end
    end
    return G
end